Skip to content

Add functions to test persistence #2012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

110CodingP
Copy link
Contributor

@110CodingP 110CodingP commented Aug 12, 2025

Description

Added basic tests to the testenv for testing custom persistence backends. Partially solves bdk_wallet#14 and might help with bdk_wallet#234.

Notes to the reviewers

An alternative approach could be to create a struct whose methods are these tests but the current approach seems better since these tests are meant to be used as unit tests. For the same reason redundant functions to check persistence of individual fields of the ChangeSets are provided.

Changelog notice

Added
    - functions to testenv to check `ChangeSet`s are persisted and merged `ChangeSet`s are loaded properly
    - tests to `file_store` and `chain` based on utilities added to `testenv`

Todo

  • Add docs
  • Add tests to bdk_chain based on testenv utilities

Checklists

All Submissions:

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

@110CodingP 110CodingP force-pushed the add_persist_test_utils branch 3 times, most recently from 8f06dc6 to 247d478 Compare August 15, 2025 11:53
@110CodingP 110CodingP marked this pull request as ready for review August 15, 2025 13:13
@notmandatory notmandatory moved this to Needs Review in BDK Chain Aug 19, 2025
Added the following functions to test if persistence of `bdk_chain` is
happening correctly.
  - `persist_txgraph_changeset`
  - `persist_indexer_changeset`
  - `persist_local_chain_changeset`
  - `persist_last_seen`, `persist_last_evicted`, `persist_first_seen`
  - `persist_txouts`
  - `persist_txs`
  - `persist_anchors`
  - `persist_last_revealed`
  - `persist_spk_cache`

Even though the first three tests cover every part of the `ChangeSet`s ,
the other tests are retained so as to help in unit testing.
@110CodingP 110CodingP force-pushed the add_persist_test_utils branch from 247d478 to 83b54a6 Compare August 19, 2025 05:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

1 participant